<extend name="template/base_index" />

<block name="area_header">
    <link rel="stylesheet" type="text/css" media="all" href="__CSS__/wxshop.css">
    <link type="text/css" rel="stylesheet" src="__CDN__/jquery-uploadify/3.2.1/uploadify.css" />
    <script type="text/javascript" src="__CDN__/jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>
    <link type="text/css" rel="stylesheet" href="__CDN__/select2/3.5.2/select2.css" />
    <script type="text/javascript" src="__CDN__/select2/3.5.2/select2.min.js"></script>
    <script type="text/javascript" src="__CDN__/select2/3.5.2/select2_locale_zh-CN.js"></script>
</block>

<block name="area_body">
    {:W('Menus/topbar')}
    <div class="admin-main container-fluid">
        {:W('Menus/left')}
        <div class="admin-main-content">
            {:W('Menus/breadcrumb')}

            <div class="col-main">
                <div class="main-hd">
                    <h2>编辑版块信息</h2>
                </div>
                <div class="main-bd clearfix" style="padding: 0 10px;margin-top: 0px;">
                    <form class="forumForm form-horizontal" method="post">
                        <input type="hidden" name="fid" value="{$fid}"/>
                        <input type="hidden" name="icon_id" id="icon_id" value="{$icon_id}">
                        <h3><i>●</i>基本信息</h3>
                        <div class="form-group col-lg-12 col-md-12 clearfix">
                            <label for="" class="control-label col-lg-2 col-md-2">版块名称</label>
                            <div class="col-lg-10 col-md-10">
                                <input name="name" maxlength="60" value="{$name}" class="js_forum_name form-control input-normal input-sm" />
                                <span class="help-block">限30个字</span>
                            </div>
                        </div>

                        <div class="form-group col-lg-12 col-md-12 clearfix">
                            <label for="" class="control-label col-lg-2 col-md-2">版块图标</label>
                            <div class="col-lg-10 col-md-10">
                                版块图标<span class="text-muted">(建议尺寸为640像素*640像素，大小不超过500kb)<i data-toggle="tooltip" class="fa fa-question"></i></span>
                                <!-- 图片选择DOM结构 -->
                                <div class="wxuploaderimg icon_id clearfix <notempty name="icon_id">checked</notempty>"  data-maxitems="1">
                                    <div class="img-preview clearfix" >
                                        <notempty name="icon_id">
                                            <div class="pull-left clearfix img-item">
                                                <img src="{:getImgUrl($icon_id,120)}" data-imageid="{$icon_id}"/>
                                                <div class="edit_pic_wrp"><a href="javascript:;" class="fa fa-lg fa-trash js_delete"></a></div>
                                            </div>
                                        </notempty>
                                    </div>
                                    <div class="add">
                                        <i class="fa fa-plus"></i>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-group col-lg-12 col-md-12 clearfix">
                            <label for="" class="control-label col-lg-2 col-md-2">排序</label>
                            <div class="col-lg-10 col-md-10">
                                <input name="displayorder" class="price form-control input-short input-sm" value="{$displayorder}" />
                            </div>
                        </div>
                        <div class="form-group col-lg-12 col-md-12 clearfix">
                            <label for="" class="control-label col-lg-2 col-md-2">上级论坛</label>
                            <div class="col-lg-10 col-md-10">
                                <select class="form-control input-short input-sm" name="fup">
                                    <option value="0">无</option>
                                    <volist name="forum_list" id="vo">
                                        <option value="{$vo.fid}" <if condition="$fup eq $vo['fid']">selected="selected"</if> >{$vo.name}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="form-group col-lg-12 col-md-12 clearfix">
                            <label for="" class="control-label col-lg-2 col-md-2">主题帖数量
                            </label>
                            <div class="col-lg-10 col-md-10">
                                {$threads}
                            </div>
                        </div>
                        <div class="form-group col-lg-12 col-md-12 clearfix js_frm_gp_sku">
                            <label for="" class="control-label col-lg-2 col-md-2 ">帖子数量
                                <br/><span class="help-block"></span>
                            </label>
                            <div class="col-lg-10 col-md-10">
                                {$posts}
                            </div>
                        </div>
                        <div class="form-group col-lg-12 col-md-12 clearfix js_frm_gp_sku hide">
                            <label for="" class="control-label col-lg-2 col-md-2 ">今日发帖
                                <br/><span class="help-block"></span>
                            </label>
                            <div class="col-lg-10 col-md-10">
                                {$todayposts}
                            </div>
                        </div>
                        <div class="form-group col-lg-12 col-md-12 clearfix js_frm_gp_sku hide">
                            <label for="" class="control-label col-lg-2 col-md-2 ">昨日发帖
                                <br/><span class="help-block"></span>
                            </label>
                            <div class="col-lg-10 col-md-10">
                                {$yesterdayposts}
                            </div>
                        </div>

                        <div class="form-group col-lg-12 col-md-12 clearfix">
                            <label for="synopsis" class="col-md-2 col-lg-2 control-label">版块描述</label>
                            <div class="col-md-10 col-lg-10">
                                <textarea name="description" id="synopsis" class="form-control" rows="5">{$description}</textarea>
                                <div class="help-block">(您最多可以输入500个字)</div>
                            </div>
                        </div>


                        <div class="form-group col-lg-12 col-md-12 clearfix js_frm_gp_buylimit">
                            <label for="" class="control-label col-lg-2 col-md-2">是否开启审核</label>
                            <div class="col-lg-10 col-md-10">
                                <label class="radio-inline">
                                    <input type="radio" name="modnewposts" <eq name="modnewposts" value="0">checked="checked"</eq> value="0">不审核
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="modnewposts" <eq name="modnewposts" value="1">checked="checked"</eq> value="1">审核
                                </label>
                            </div>
                        </div>

                        <div class="form-group col-lg-12 col-md-12 clearfix tool-bar text-center border">
                            <a target-form="forumForm" href="{:U('Admin/BbsForum/edit')}" onclick="return check();"  class="ajax-post btn btn-primary" id="js_submit"><i class="fa fa-check"></i>确定</a>
                            <a href="{:U('Admin/BbsForum/index',array('fup'=>I('fup',0)))}" class="btn btn-default"><i class="fa fa-reply"></i>返回</a>
                        </div>
                </form>
            </div>
        </div>

        <include file="template/wxpicture" />
    </div>
    <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
</block>

<block name="area_footer">
    <script type="text/javascript">
        //初始化select2 控件
        function initSelect2(){
            $('select').select2();
        }

        function getData(){

            var icon_id = $(".icon_id .img-preview img").attr("data-imageid");
            if(icon_id){
                $("#icon_id").val(icon_id);
                $('#icon_id').attr('value',icon_id);
            }

        }


        function check(){
            getData();
            var txt = $(".js_forum_name").val();
            var len = txt.replace(/[^\x00-\xff]/g, 'xx').length ;
            if(len == 0){
                $.scojs_message('版块名称必须填写', $.scojs_message.TYPE_ERROR);
                return false;
            }
            if(len > 30){
                $.scojs_message('版块名称不能超过30个字', $.scojs_message.TYPE_ERROR);
                return false;
            }
            return true;
        }

        $(function() {
            //initSelect2();
            //图片上传
            wxuploadimg.init({cont:".wxuploaderimg"});

        })

    </script>

</block>